import { myRequest} from '@/utils/api.js'


let CRMURL='workorder';

//简报数据
export function apiStatistics(data) {

	let action = data.action || '';
	let postdata = data.params || '';

	switch (action) {
		case 'get_list':
			return myRequest(CRMURL + '/api.statistics/index', postdata)
			break;
		default:
			let text = "期待周末！";
			return Promise.resolve(text);
	}
}


//线索接口
export function apiOaService(data) {

	let action = data.action || '';
	let postdata = data.params || '';

	switch (action) {
		case 'get_list':
			return myRequest(CRMURL + '/api.OaService/show_json', postdata)
			break;
		case 'get_list_public':
			return myRequest(CRMURL + '/api.OaService/show_public', postdata)
			break;
		case 'add':
			return myRequest(CRMURL + '/api.OaService/add', postdata)
			break;
		case 'update':
			return myRequest(CRMURL + '/api.OaService/edit', postdata)
			break;
		case 'del':
			return myRequest(CRMURL + '/api.OaService/del', postdata)
			break;
		case 'distribute':
			return myRequest(CRMURL + '/api.OaService/distribute', postdata)//分配工单
			break;
		case 'goto_public':
			return myRequest(CRMURL + '/api.OaService/gotopublic', postdata)
			break;
		case 'goto_personal':
			return myRequest(CRMURL + '/api.OaService/gotopersonal', postdata)
			break;
		case 'goto_customer':
			return myRequest(CRMURL + '/api.OaService/gotocustomer', postdata)
			break;
		case 'common':
			return myRequest(CRMURL + '/api.OaService/common', postdata)
			break;
		default:
			let text = "期待周末！";
			return Promise.resolve(text);
	}
}
